package kr.hkit.powerjava.chapter07.Programming;

public class ConsVowel {

	private int cons, vowel, length;
	private String str;

	public ConsVowel(String str) {
		super();
		this.str = str;
	}

	public void setStr(String str) {
		this.str = str;
	}

	void calConsVowel() {
		length = str.length();

		for (int i = 0; i < length; i++) {
			switch (str.charAt(i)) {
			case 'a':
			case 'e':
			case 'i':
			case 'o':
			case 'u':
				vowel++;
				break;

			case 'b':
			case 'c':
			case 'd':
			case 'f':
			case 'g':
			case 'h':
			case 'j':
			case 'k':
			case 'l':
			case 'n':
			case 'm':
			case 'p':
			case 'q':
			case 'r':
			case 's':
			case 't':
			case 'v':
			case 'w':
			case 'x':
			case 'y':
			case 'z':
				cons++;
				break;

			default:
				break;
			}
		}
	}

	@Override
	public String toString() {
		calConsVowel();
		return "ConsVowel [str=" + str + ", cons=" + cons + ", vowel=" + vowel
				+ "]";
	}
}
